package com.sl.springmvc.swagger.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.simple.SimpleJdbcCall;

import javax.sql.DataSource;


public class BaseDaoImpl implements BaseDao{

    private DataSource localMysqlDataSource;

    private NamedParameterJdbcTemplate localMysqlJdbcTemplate;

    private SimpleJdbcCall call;


    @Autowired
    public void setLocalMysqlDataSource(@Qualifier("mysqlDataSource") DataSource localMysqlDataSource) {
        this.localMysqlDataSource = localMysqlDataSource;
    }

    @Autowired
    public void setLocalMysqlJdbcTemplate(@Qualifier("mysqlDataSource")  DataSource dataSource) {
        this.localMysqlJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
    }

    public DataSource getLocalMysqlDataSource() {
        return localMysqlDataSource;
    }

    public NamedParameterJdbcTemplate getLocalMysqlJdbcTemplate() {
        return localMysqlJdbcTemplate;
    }
}
